using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections;
using System.Data.SqlClient;
using System.Xml;
using System.Data.Common;

/// <summary>
/// Summary description for DataProvider
/// </summary>
public class DataProvider
{
    public SqlConnection strCnn;

    public DataProvider()
    {
        //
        // TODO: Add constructor logic here
        //
    }/*
    public void connectXML()
    {
        string cn = DocXML("..\\..\\connectring.xml");
        strCnn = new SqlConnection(cn);
        strCnn.Open();
    }*/
    public void connect()
    {
        string cn = "Data Source=PHUONG\\SQLEXPRESS; Initial Catalog= QUANLIBOMON;Integrated Security=True";
        strCnn = new SqlConnection(cn);
        strCnn.Open();
    }/*
    public static string DocXML(string fileName)
    {
        string connect = "";
        XmlDocument TaiLieu = new XmlDocument();

        XmlElement goc = TaiLieu.DocumentElement;
        try
        {
            TaiLieu.Load(fileName);
            goc = TaiLieu.DocumentElement;
            connect = goc.GetAttribute("string_connect");
            return connect;
        }
        catch (Exception ex)
        {
            ex.ToString();
        }
        return null;
    }*/
    public void disconnect()
    {
        strCnn.Close();
    }
    protected ArrayList ConvertDataSetToArrayList(DataSet dataset)
    {
        ArrayList arr = new ArrayList();
        DataTable dt = dataset.Tables[0];
        int i, n = dt.Rows.Count;
        for (i = 0; i < n; i++)
        {
            object hs = GetDataFromDataRow(dt, i);
            arr.Add(hs);

        }
        return arr;
    }
    protected virtual object GetDataFromDataRow(DataTable dt, int i)
    {
        return null;
    }
}